<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <script>
        function Star(uname, age, sex) {
            this.name = uname;
            this.age = age;
            this.sex = sex;
            this.sing = function (sang) {
                console.log(sang);
            }
        }
        var ldh = new Star('刘德华', 25, '男');
        console.log(ldh.name);
        console.log(ldh['age']);
        ldh.sing('冰雨');

        var zxy = new Star('张学友', 30, '男');
        console.log(zxy.name);
        console.log(zxy['age']);
    </script>
</body>
</html>